/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.delivery.parcel.app.factory;

import com.delivery.parcel.model.Citizen;
import com.delivery.parcel.model.Contact;
import com.delivery.parcel.model.Customer;
import com.delivery.parcel.model.CustomerAddress;
import com.delivery.parcel.model.Demographic;
import com.delivery.parcel.model.Destination;
import com.delivery.parcel.model.Employee;
import com.delivery.parcel.model.Job;
import com.delivery.parcel.model.Name;
import com.delivery.parcel.model.Parcel;
import com.delivery.parcel.model.TypeOfService;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Malotana
 */
public class AppFactory {
    public static CustomerAddress getAddress(Map<String, String>values){
        CustomerAddress customerAddress = new CustomerAddress();
        customerAddress.setStreetAddress("streetAddress");
        customerAddress.setPostalAddress("postalAddress");
        return customerAddress;
    }
    
    public static Citizen getCitizen(Map<String, String>values){
        Citizen citizen = new Citizen();
        citizen.setCity(values.get("city"));
        citizen.setProvince(values.get("streetAddress"));
        citizen.setPostalCode(values.get("postalCode"));
        return citizen;
    }
    
    public static Contact getContact(Map<String, String>values){
         Contact contact = new Contact();
         contact.setCellNumber(values.get("cellNumber"));
         contact.setPhoneNumber(values.get("phoneNumber"));
         return contact;
    }
    
    public static Customer getCustomer(Map<String, String>values, Name name, Contact contact, Demographic demographic, CustomerAddress customerAddress,List<Parcel> parcel, List<Employee> employees){
       Customer customer = new Customer();
       customer.setName(name);
       customer.setContact(contact);
       customer.setDemographic(demographic);
       customer.setCostumerAddress(customerAddress);
       customer.setParcel(parcel);
       customer.setEmployee(employees);
       customer.setCustomerNumber(values.get("customerNumber"));
       return customer;
    }
    
    public static Destination getDestination(Map<String, String> values){
        Destination destination = new Destination();
        destination.setDestinationNumber(values.get("destinationNumber"));
        return destination;
    }
    
    public static Employee getEmployee(Map<String, String> values, Date hireDate, BigDecimal Salary){
        Job job = new Job();
        job.setHireDate(hireDate);
        job.setSalary(Salary);
        job.setJobTitle("Driver");
        Employee emp = new Employee();
        emp.setFirstName(values.get("firstName"));
        emp.setLastName(values.get("lastName"));
        emp.setContact(values.get("contact"));
        emp.setJob(job);
        return emp;
    }
    
    public static Demographic getDemographic(Map<String, String>values, Date dateOfBirth){
         Demographic demographic = new Demographic();
         demographic.setDateOfBirth(dateOfBirth);
         demographic.setRace(values.get("race"));
         demographic.setGender(values.get("gender"));
         return demographic; 
    }
    
    public static Job getJob(Map<String, String>values, Date date, BigDecimal salary){
        Job job = new Job();
        job.setJobTitle(values.get("jobTitle"));
        job.setSalary(salary);
        job.setHireDate(date);        
        return job;
    }
    
    public static Name getName(Map<String, String>values){
         Name name = new Name();
         name.setFirstName(values.get("firstName"));
         name.setLastName(values.get("lastName"));  
         return name;
    }
    
    public static Citizen getParcel(Map<String, String>values, int weight, BigDecimal TotalCost, Date depDate, Date arrDate){
        Citizen citizen = new Citizen();
        citizen.setCity(values.get("city"));
        citizen.setProvince(values.get("streetAddress"));
        citizen.setPostalCode(values.get("postalCode"));
        
        Destination destination = new Destination();
        destination.setDestinationNumber("50");
        
        Parcel parcel = new Parcel();
        parcel.setWeight(weight);
        parcel.setCost(TotalCost);
        parcel.setDepDate(depDate);
        parcel.setArrDate(arrDate);
        destination.getParcel().add(parcel);
        citizen.getDestination().add(destination);
        return citizen;
    }
    
    public static TypeOfService getTypeOfService(Map<String, String>values, BigDecimal costPerKilo){
        TypeOfService typeOfService = new TypeOfService();
        typeOfService.setServiceNumber(values.get("serviceNumber"));
        typeOfService.setServiceType(values.get("serviceType"));
        typeOfService.setCostPerKilo(costPerKilo);
        return typeOfService;
    }
    
    public static Parcel getParcelDetails(Map<String, String>streetValues, int weight, BigDecimal TotalCost, Date depDate, Date arrDate){
        Parcel parcel = new Parcel();
        parcel.setWeight(weight);
        parcel.setCost(TotalCost);
        parcel.setDepDate(depDate);
        parcel.setArrDate(arrDate);
        parcel.setStreetAddress(streetValues.get("streetAddress"));
        return parcel;
   }
}